using GridExtend;
using MyEditor.ShapeEditor;
using System.Collections.Generic;
using Triggers;
using UnityEngine;

[RequireComponent(typeof(GridTransform), typeof(RectEditor))]
public abstract class BoxTrigger<T> : Trigger<T>
{
    private MyGrid myGrid;
    private RectEditor rectEditor;

    protected virtual void Awake()
    {
        myGrid = ActionController.GlobalGrid;
        rectEditor = GetComponent<RectEditor>();
    }

    protected override List<T> CheckContact()
    {
        return GetContact(GridTool.ToGrid(rectEditor.WorldRect, myGrid));
    }

    protected abstract List<T> GetContact(RectInt rect);
}
